package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbContentMapper;
import com.dongdongshop.pojo.TbContent;
import com.dongdongshop.pojo.TbContentCategory;
import com.dongdongshop.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class ContentServiceImpl implements ContentService {

    @Autowired
    private TbContentMapper tbContentMapper;

    @Override
    public List<TbContent> findAll() {
        List<TbContent> list = tbContentMapper.selectByExample(null);
        return list;
    }

    @Override
    public TbContent selectById(Long id) {
        TbContent tbContent = tbContentMapper.selectByPrimaryKey(id);
        return tbContent;
    }

    @Override
    public void updateContent(TbContent tbContent) {
        tbContentMapper.updateByPrimaryKeySelective(tbContent);
    }

    @Override
    public void insert(TbContent tbContent) {
        tbContentMapper.insertSelective(tbContent);
    }

    @Override
    public void deleteAll(Long[] ids) {
        tbContentMapper.deleteAll(ids);
    }

    @Override
    public List<TbContentCategory> selectPic(Long categoryId, Integer count) {
        return tbContentMapper.selectPic(categoryId,count);
    }


}
